<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<div id="roleEditDialog-form" title="修改">
	<form id="editForm" action="${pageContext.request.contextPath }/pages/role_save.do" method="post">
		<fieldset>
			<input type="hidden" id="role_id" name="role.id" />
			<label class="f_label" for="name">
				角色名称：
			</label>
			<input type="text" name="role.name" class="text" id="role_name" />
			<br>
			<label class="f_label" for="description">
				角色描述：
			</label>
			<input type="text" name="role.description" class="text" id="role_description" />
			<label class="f_label" for="res">
				拥有资源：
			</label>
			<input type="hidden" name="addResIds" id="addResIds" />
			<input type="hidden" name="delResIds" id="delResIds" />
			<div id="res">
			</div>
		</fieldset>
	</form>
	<script type="text/javascript">
		function editFormCollecter() {
			var delObjs = $("input[class='alOwn']:not(:checked)"); 
			var addObjs = $("input[class='notOwn']:checked");
			//var objs = document.getElementById("res").getElementsByTagName("input");   
			var delRes_ids = "";
			var addRes_ids = "";
			for(var i = 0; i < delObjs.length; i++) {
      			if(delRes_ids != "") {   
       				delRes_ids += ",";   
      			}   
      			delRes_ids += delObjs[i].value;   
			} 
			for(var i = 0; i < addObjs.length; i ++) {
				if(addRes_ids != "") {   
       				addRes_ids += ",";   
      			}   
      			addRes_ids += addObjs[i].value;  
			}
			if(addRes_ids != "" ) {
				$("#addResIds").val(addRes_ids);
			} 
			if(delRes_ids != "") {
				$("#delResIds").val(delRes_ids);
			}
			$("#editForm").submit(); 
			return false;
		}
	</script>
</div>
